Screen object

Description
The Screen object lets you get information about and set options for the monitor(s) connected to your Macintosh. If you have only one monitor, then the Screen object needs no specifier. If you have more than one monitor, then using Screen without a specifier refers to the main (menu bar) monitor, Screen(2) refers to the second monitor, and so on. Screens are numbered as they appear in the Monitors & Sound control panel.

.Color
Gets or sets the Colors and Grays options in the Monitors & Sound control panel. Setting .Color to 1 switches the monitor to colors and setting .Color to 0 (zero) switches it to grays.

// Change the monitor to grayscale mode
Screen.Color = 0

.Count
Returns the number of monitors connected to the computer.

If Screen.Count = 1
     Message "This is a standard configuration."
Else If Screen.Count = 2 
     Message "You’re a Power User."
Else If Screen.Count >= 3
     Message "Beware of electromagnetic radiation!"
End If

.CursorScreen
Returns a number indicating which screen the cursor is on.

.CursorX
Sets or returns the current global horizontal position of the cursor.

// Move the cursor to 40 pixels from the left, 80 from the top
Screen.CursorX = 40
Screen.CursorY = 80

.CursorY
Sets or returns the current global vertical position of the cursor.

.Depth
Gets or sets the number of colors displayed on the monitor. The .Depth property uses a number (the bit depth) to determine the number of colors. The following table shows bit depth values and the corresponding settings in the Monitors & Sound control panel; your system may not support all the bit depths listed here.

.Depth value      Monitors control panel setting
1                            Black & White
2                            4
4                            16
8                            256
16                          Thousands
32                          Millions

// Switch to millions of colors before opening Adobe Photoshop
Screen.Depth = 32
Open "Mac HD:Applications:Adobe Photoshop:Adobe Photoshop™ 2.5.1"

.Exists
Determines if the specified monitor exists. This property is useful in determining if more than one monitor is connected.

// Display a message if only one monitor is connected
If NOT Screen(2).Exists
     Message "Can’t find a second monitor"
End If

.Height
Returns the height (in pixels) of the specified monitor. Getting the screen’s height is useful when you want to position palettes or windows at (or near) the bottom of the screen.

// Move the palette to the bottom of the screen
Palette.Top = Screen.Height – Palette.Height

.Left
Returns the location of the left edge of the specified monitor relative to Screen(1), the main (menu bar) monitor. For single-monitor systems, .Left always returns 0. If you have a second monitor connected, Screen(2).Left returns the left edge of the second monitor relative to the left edge of the main monitor. For example, assume the following:

• you have two monitors
• the main monitor is 1152 pixels wide by 870 pixels tall
• the second monitor is 832 pixels wide by 624 pixels tall
• the second monitor is positioned to the right of the main monitor

In this setup, Screen(2).Left returns 1152 because the main monitor goes from 0 (on the left edge) to 1151 (on the right). If the second monitor was positioned to the left of the main monitor, then Screen(2).Left would return –832.

Note
Depending on your computer model and system software version, your Monitors control panel may look different than the picture above.

// Position the palette in the upper-right corner of the second monitor.
Palette.Left = Screen(2).Left + Screen(2).Width – Palette.Width
Palette.Top = Screen(2).Top + 12

.Maximum
Returns the maximum bit depth supported by the specified screen. The .Maximum property returns its value as a number of bits (1, 2, 4, 8, 16, or 32). See the .Depth property for a table of bit depth values and their meanings.

.Top
Returns the location of the top edge of the specified monitor relative to Screen(1), the main (menu bar) monitor. For single-monitor systems, .Top always returns 0. If you have a second monitor connected, Screen(2).Top returns the top edge of the second monitor relative to the top edge of the main monitor. (See the .Left property for an explanation of how this works.)

.Update
Forces the Macintosh to redraw the entire contents of the screen, including the menu bar, the desktop, and all windows and palettes. Use Screen.Update when some other program malfunctions and leaves garbage on the desktop or in a window. 

.Width
Returns the width (in pixels) of the specified monitor. Getting the screen’s width is useful when you want to position palettes or windows at (or near) the right edge of the screen.

// Move the palette to the right edge of the screen
Palette.Left = Screen.Width – Palette.Width